/**
 * @name 加密工具类
 * @author qianShang
 * @version 20230919
 */
export class EncryptionUtil{
    private static _Ins: EncryptionUtil;
    public static get Ins() {
        if (this._Ins == null) {
            this._Ins = new EncryptionUtil();
        }
        return this._Ins;
    }

    //#region 异或算法加密
    /**
     * 异或加密
     * @param plaintext 被加密数值
     * @param key 加密密钥 
     * @returns 
     */
    public XOREncrypt(plaintext: number,key: number): number {
        return plaintext ^ key;
    }
    
    /**
     * 异或解密
     * @param ciphertext 被加密数值
     * @param key 加密密钥 
     * @returns 
     */
    public XORDecrypt(ciphertext: number, key: number): number {
        return ciphertext ^ key;
    }
    //#endregion
}